[AutoComplete] use sublime text like search instead of Levenshtein Distance for fuzzy search#4164
Conversation
|
This is for issue #4159 |
|
|
||
| describe('<AutoComplete />', () => { | ||
| it('search using fuzzy filter', () => { | ||
| assert.ok(AutoComplete.fuzzyFilter('ea', 'Peach'), 'should match Peach with ea'); |
There was a problem hiding this comment.
I would rather use this pattern instead of ok/notOk.
assert.strictEqual(actual, true, 'reason');
assert.strictEqual(actual, false, 'reason');|
@ddeath The logic looks good to me. Thanks for adding some tests! Could you have a look at my comments? |
|
@oliviertassinari I already did 😄 |
|
@ddeath Awesome. |
aa2addc to
6fbf19a
Compare
|
@oliviertassinari done |
|
@ddeath can you add a couple more tests (with slightly longer and more complex strings)? A a couple of "close but no cigar" non-matches would be good too 👍 Would be cool to have the limitations documented. |
…stance for fuzzy search
6fbf19a to
c0cb49c
Compare
|
Hi I added some more test, but I could not came up with anything else, since it appears to be quite simple algorithm... If you have any ideas feel free to share it with me I can write some more tests then. |
|
@ddeath great, thanks! |
|
@ddeath Thanks! |
The problem was that fuzzy search used Levenshtein Distance for matching.
It resulted that Peach was not matched by ea.
So i use search similar to the sublime text fuzzy search in ctrl + p also inspired by https://github.com/mattyork/fuzzy
Basically pattern will match if you will get it from search text by deleting some letters.
If someone would like Levenshtein Distance there is still filter for them.